Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAL/vm-common] Get memory regions from VMM using "etc/e820" fw_cfg file #28

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

dimakuv
Copy link
Contributor

@dimakuv dimakuv commented May 7, 2024

Description of the changes

Previously on the VM PAL, we hard-coded a single memory region that is RAM (i.e., not reserved) via FW_CFG_RAM_SIZE. This is a dangerous assumption which may break in the future. This commit uses a proper source of E820 info: the etc/e820 fw_cfg file.

As a side effect, find_fw_cfg_selector() function was slightly modified to also return the size of the object. All callers of this function now use this returned size.

Fixes #27.

How to test this PR?

Run on newer QEMU.


This change is Reviewable

Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion

a discussion (no related file):
Blocking: must test and understand all reserved ranges on new QEMU/on different environments.


@dimakuv dimakuv force-pushed the dimakuv/parse-etc-e820-fwcfg-file branch from a6cba2d to fb38207 Compare May 8, 2024 13:43
Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, all discussions resolved

a discussion (no related file):

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

Blocking: must test and understand all reserved ranges on new QEMU/on different environments.

Update: the problem was not related to some new reserved memory ranges on newer QEMU (v8.0).

The root cause was that docker run ... by default sets 64MB of /dev/shm. As soon as I set this limit to the one used by Gramine VMs, it started working: e.g. docker run --shm-size 4G.


Previously on the VM PAL, we hard-coded a single memory region that is
RAM (i.e., not reserved) via `FW_CFG_RAM_SIZE`. This is a dangerous
assumption which may break in the future. This commit uses a proper
source of E820 info: the `etc/e820` fw_cfg file.

As a side effect, `find_fw_cfg_selector()` function was slightly
modified to also return the size of the object. All callers of this
function now use this returned size.

Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
@dimakuv dimakuv force-pushed the dimakuv/parse-etc-e820-fwcfg-file branch from fb38207 to 0e8293d Compare July 10, 2024 08:43
Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@dimakuv dimakuv merged commit 0e8293d into intel_tdx Jul 10, 2024
2 checks passed
@dimakuv dimakuv deleted the dimakuv/parse-etc-e820-fwcfg-file branch July 10, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PAL/vm] Use etc/e820 fw_cfg file to learn reserved memory ranges
1 participant